package com.lyz.dataStructure.algorithm.beike2020;/**
 * @Author:759057893@qq.com Lyz
 * @Date: ${Date} 20:45
 * @Description:
 **/

import java.util.Scanner;

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/8/10 20:45
 *@Description:
 **/
/*
和main是一个题
 */
public class Main5 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] num =new long[n];
        for(int i =0;i<n;i++){
            num[i] = sc.nextLong();
        }
        int cur = 0;
        long min = Math.abs(num[0]-num[1]);
        for(int i =1;i<n-1;i++){
            long tem = Math.abs(num[i]-num[i+1]);
            if(tem<min){
                cur = i;
                min =tem;
            }
        }
        System.out.printf("%d %d",num[cur],num[cur+1]);
    }
}
